<?php


namespace App\Models;


use App\Engine\BaseModel;

/**
 * Class Chicken
 *
 * @property int $id
 * @property int $type
 * @property string|null $name
 * @property string|null $content
 * @property string|null $image
 * @property int $created_at
 * @property int $updated_at
 *
 * @package App\Models
 */
class Banner extends BaseModel
{
    protected $table = 'banners';
    public $timestamps = false;
    protected $fillable = [
        'name',
        'image',
        'type',
        'sort',
        'hidden',
        'value'
    ];

    public $with=["article","project"];


    public function article()
    {
        return $this->belongsTo("App\Models\Article","value","id");
    }

    public function project()
    {
        return $this->belongsTo("App\Models\House","value","id");
    }

    public $rule=[
        'name'=>'required',
        'image'=>'required',
        'type'=>'required',
        'sort'=>'required',
    ];

    public $ruleMessage=[
        'name.required'=>"请填写标题",
        'image.required'=>"请上传图片",
        'type.required'=>"请选择类型",
        'sort.required'=>"请输入排序",
    ];
}
